package com.vogue.supplymall.shop.domain.service;

import com.vogue.supplymall.common.domain.dto.QueryListResultInfo;
import com.vogue.supplymall.common.domain.dto.SearchInfo;
import com.vogue.supplymall.shop.domain.model.Shop;

import java.util.List;
import java.util.Map;

/**
 * The interface Shop service.
 *
 * @aouthor: zhangliang
 * @create: 2017 -12-01
 */
public interface ShopService extends BaseService<Shop, Long> {

    /**
     * Find by id shop.
     * 按id检索店铺
     *
     * @param id      the id
     * @param loginId the login id
     * @return the shop
     */
    Map<String, Object> findById(Long id, Long loginId);

    /**
     * Find by name shop.
     * 按检索框检索店铺信息
     *
     * @param searchInfo the search info
     * @return the shop
     */
    List<Map<String, Object>> findBySearchInfo(SearchInfo searchInfo);

    /**
     * 返回带总记录数的结果集合
     * 
     * @param searchInfo
     * @return
     */
    QueryListResultInfo findListBySearchInfo(SearchInfo searchInfo);
    
    /**
     * add shop shop.
     * 供应链对接使用
     * 增加店铺信息
     *
     * @param shop the shop list
     * @return the shop
     */
    List<Shop> addShop(List<Shop> shop);

    /**
     * Gets shop.
     * 供应链对接使用
     * 通过唯一注册号id和对应机构id，得到店铺信息
     *
     * @param sysCodeId the sys code id
     * @param organId   the organ id
     * @return the shop
     */
    Shop getShop(Long sysCodeId, Long organId);

    /**
     * 更改门店的隐藏属性
     *
     * @param shopId     the shop id
     * @param sysCodeId  the sys code id
     * @param hiddenFlag the hidden flag
     */
    public void changeHiddenFlagOfShop(Long shopId, Long sysCodeId, int hiddenFlag);

    /**
     * Find shop by sql list.
     * 根据条件检索开通资质的店铺
     *
     * @param searchInfo the search info
     * @return the list
     * @throws RuntimeException the runtime exception
     */
    List<Map<String, Object>> findLicenceShopBySql(SearchInfo searchInfo) throws RuntimeException;

    /**
     * Count valid shop long.
     * admin-business使用，查询所有开通的店铺
     *
     * @return the long
     */
    Long countValidShop();

    /**
     * Count by syscodeid long.
     * admin-business使用，查询集团下未开通店铺数
     *
     * @param syscodeid the syscodeid
     * @return the long
     */
    Long countBySyscodeid(Long syscodeid);
    /**
     * 根据matchid和syscodeid找对应的店铺
     */
    public Shop findShopByMS(Long syscodeId,String matchId);
    /**
     * 根据syscodeId更新shop表的企业名称
     */
    public void updateEntnameBySyscodeId(Long syscodeId,String entName) throws Exception;
    /**
     * 根据店铺id查找店铺对应的商品分类主键集合
     * @return
     */
    public List<Map<String,Object>> findShopCategoryIds(Long id);
    /**
     * 根据syscodeId更新shop表 是否等待手动接单标记
     */
    public void updateWaitingOrderBySyscodeId(Long syscodeId, Boolean waitingOrder) throws Exception;
}
